package com.hnkywl.sts.entity.jhgl;

import com.hnkywl.sts.entity.BaseEntity;
import com.hnkywl.sts.entity.organ.*;
import com.hnkywl.sts.entity.sys.Yg;
import org.hibernate.annotations.*;

import javax.persistence.*;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: ZHUCHG
 * Date: 13-4-23
 * Time: 下午7:20
 * To change this template use File | Settings | File Templates.
 */
@Entity
@Table(name = "T_BIZ_BGJH")
@Where(clause = "deleted!='1'")
public class Bgjh extends BaseEntity {
    //ID
    @Id
    @SequenceGenerator(name = "seqBgjh", allocationSize = 1, sequenceName = "SEQ_BIZ_BGJH")
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seqBgjh")
    private Long id;
    // 计划类别  ydjh:月度计划  jyljh急用料计划  zjjh:追加计划  bccbjh:补充储备计划
    private String type;

    //计划编码
    private String bm;

    // 经营机构
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "LJ_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Lj lj;
    // 经营机构
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "JYJG_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Nbgs jyjg;
    // 供应站
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "GYZ_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Nbbm gyz;
    //到货仓库
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "DHCK_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Ck dhck;
    // 保供计划单位
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "JHDW_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Gsjg jhdw;
    // 保供单位科室(部门)
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "JHQD_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Gsjg jhqd;
    //计划年份
    private Integer jhnf;
    //计划月份
    private Integer jhyf;
    //说明
    @Column(length = 4000)
    private String sm;
    //标注
    @Column(length = 4000)
    private String bz;

    // 提交人
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "BGJHTJR_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Yg bgjhtjr;
    // 提交日期
    private Date bgjhtjrq;

    //状态  1=新建,2=已提交,3=已汇总
    private Integer zt = 1;
    //退回原因
    private String thyy;
    //退回人
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "THR_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Yg thr;
    //退回时间
    private Date thsj;
    //保供计划明细
    @OneToMany(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REMOVE},
            targetEntity = Bgjhmx.class, mappedBy = "bgjh")
    @NotFound(action = NotFoundAction.IGNORE)
    @Where(clause = "deleted!='1'")
    private List<Bgjhmx> bgjhmxList;
    //保供计划汇总
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "BGJHHZ_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Bgjhhz bgjhhz;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getBm() {
        return bm;
    }

    public void setBm(String bm) {
        this.bm = bm;
    }

    public Lj getLj() {
        return lj;
    }

    public void setLj(Lj lj) {
        this.lj = lj;
    }

    public Nbgs getJyjg() {
        return jyjg;
    }

    public void setJyjg(Nbgs jyjg) {
        this.jyjg = jyjg;
    }

    public Nbbm getGyz() {
        return gyz;
    }

    public void setGyz(Nbbm gyz) {
        this.gyz = gyz;
    }

    public Ck getDhck() {
        return dhck;
    }

    public void setDhck(Ck dhck) {
        this.dhck = dhck;
    }

    public Gsjg getJhdw() {
        return jhdw;
    }

    public void setJhdw(Gsjg jhdw) {
        this.jhdw = jhdw;
    }

    public Gsjg getJhqd() {
        return jhqd;
    }

    public void setJhqd(Gsjg jhqd) {
        this.jhqd = jhqd;
    }

    public Integer getJhnf() {
        return jhnf;
    }

    public void setJhnf(Integer jhnf) {
        this.jhnf = jhnf;
    }

    public Integer getJhyf() {
        return jhyf;
    }

    public void setJhyf(Integer jhyf) {
        this.jhyf = jhyf;
    }

    public String getSm() {
        return sm;
    }

    public void setSm(String sm) {
        this.sm = sm;
    }

    public String getBz() {
        return bz;
    }

    public void setBz(String bz) {
        this.bz = bz;
    }

    public Integer getZt() {
        return zt;
    }

    public void setZt(Integer zt) {
        this.zt = zt;
    }

    public String getThyy() {
        return thyy;
    }

    public void setThyy(String thyy) {
        this.thyy = thyy;
    }

    public Yg getThr() {
        return thr;
    }

    public void setThr(Yg thr) {
        this.thr = thr;
    }

    public Date getThsj() {
        return thsj;
    }

    public void setThsj(Date thsj) {
        this.thsj = thsj;
    }

    public List<Bgjhmx> getBgjhmxList() {
        return bgjhmxList;
    }

    public void setBgjhmxList(List<Bgjhmx> bgjhmxList) {
        this.bgjhmxList = bgjhmxList;
    }

    public Bgjhhz getBgjhhz() {
        return bgjhhz;
    }

    public void setBgjhhz(Bgjhhz bgjhhz) {
        this.bgjhhz = bgjhhz;
    }

    public Yg getBgjhtjr() {
        return bgjhtjr;
    }

    public void setBgjhtjr(Yg bgjhtjr) {
        this.bgjhtjr = bgjhtjr;
    }

    public Date getBgjhtjrq() {
        return bgjhtjrq;
    }

    public void setBgjhtjrq(Date bgjhtjrq) {
        this.bgjhtjrq = bgjhtjrq;
    }
}
